#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
cmake_minimum_required(VERSION 3.13.1)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(NONE)

# NORDIC SDK APP START
if (CONFIG_BOARD_NATIVE_POSIX)
target_link_libraries(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/mesh-auth-native-debug.a)
else ()
target_link_libraries(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/mesh-auth-cortex-m4-debug.a)
endif ()

add_definitions(-DCUSTOMIZED_MI_CONFIG_FILE=<custom_mi_config.h>)
add_definitions(-DMI_LOG_ENABLED=1)
add_definitions(-DMI_ASSERT)

target_sources(app PRIVATE src/main.c)
target_sources(app PRIVATE src/on_action_invoke.c)
target_sources(app PRIVATE src/on_property_request.c)
target_sources(app PRIVATE src/on_property_get.c)
target_sources(app PRIVATE src/on_property_set.c)
target_sources(app PRIVATE src/S_2_Light_doAction.c)
target_sources(app PRIVATE src/S_2_Light_doChange.c)
target_sources(app PRIVATE src/S_1_DeviceInformation_doGet.c)
target_sources(app PRIVATE src/S_2_Light_doGet.c)
target_sources(app PRIVATE src/S_2_Light_doSet.c)

target_sources(app PRIVATE mijia_ble_api/ble.c)
target_sources(app PRIVATE mijia_ble_api/mesh.c)
target_sources(app PRIVATE mijia_ble_api/nvm_zephyr.c)
target_sources(app PRIVATE mijia_ble_api/mi_potp_0xec4d3ebdd2c1.c)
target_sources(app PRIVATE mijia_ble_api/mible_api.c)
target_sources(app PRIVATE mijia_ble_api/mible_mcu.c)
target_sources(app PRIVATE mijia_ble_api/mible_mesh_api.c)

target_sources(app PRIVATE mijia_ble_libs/mi_config.c)
target_sources(app PRIVATE mijia_ble_libs/third_party/pt/pt_misc.c)

target_sources(app PRIVATE mijia_ble_libs/third_party/mbedtls/ccm.c)
target_sources(app PRIVATE mijia_ble_libs/third_party/mbedtls/sha256_hkdf.c)
target_sources(app PRIVATE mijia_ble_libs/third_party/mbedtls/md.c)
target_sources(app PRIVATE mijia_ble_libs/third_party/mbedtls/md_wrap.c)
target_sources(app PRIVATE mijia_ble_libs/third_party/mbedtls/sha256.c)
target_sources(app PRIVATE mijia_ble_libs/third_party/mbedtls/asn1parse.c)
target_sources(app PRIVATE mijia_ble_libs/third_party/mbedtls/base64.c)
target_sources(app PRIVATE mijia_ble_libs/third_party/micro-ecc/uECC.c)
target_sources(app PRIVATE mijia_ble_libs/third_party/SEGGER_RTT/SEGGER_RTT_printf.c)

target_include_directories(app PRIVATE inc)
target_include_directories(app PRIVATE mijia_ble_api)
target_include_directories(app PRIVATE mijia_ble_libs)
target_include_directories(app PRIVATE mijia_ble_libs/mijia_profiles)
target_include_directories(app PRIVATE mijia_ble_libs/mesh_auth)
target_include_directories(app PRIVATE mijia_ble_libs/third_party/micro-ecc/)
target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/bluetooth/host)


# NORDIC SDK APP END

zephyr_library_include_directories(.)
